Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The unary
~operator in core/vm.cpp converts its operand with a raw(long)cast, while<<,>>,&,^and|all go through safeDoubleToInt64. As a result~1e300is undefined behaviour (UBSan float-cast-overflow; arm64 saturates and prints -9223372036854775808, x86-64 cvttsd2si gives LONG_MIN so the sign flips), values past 2^53 are accepted silently while1e300 & 1raises an error, and on Windows, where long is 32 bits,~4294967296is UB even though the spec says bitwise operands are converted to signed 64-bit integers. Fixed by converting the operand with safeDoubleToInt64, so~now always uses int64_t and raises the same "numeric value outside safe integer range for bitwise operation" error; results inside the safe range (including the existing safe_integer_conversion cases) are unchanged, and test_suite passes with the new error.integer_bitwise_not case, which fails before the patch.